﻿//name:worried trader
//who: by Jack Chen
//what: just make a logic for worried trader

#include <mudlib.h>
#include <daemons.h>
#include <ansi.h>

#include <trader.h>

/*
//// This is how it works
1. we have a RT built-in type: MONSTER , a real object. however, this is not revealed to the user ( for the reason of "encapsulation" (C++ 的 "封裝")
2. For the sake of control, there should be a pointer named pMONSTER pointing to the object MONSTER  ( pMonster = &MONSTER )
3. Then, the coder "inherits" pMONSTER and create a new class: pTrader , which is also a pointer as well

4. So here''s the deal.... since the coder never has the change to access the real object "MONSTER" directly (everything is done via pointers),
   Somehow Iris shorten then name. What he did was:

   4.1 changed the real obj. name to rMONSTER , and make this un-accessiable for the users (it's not exposed to users)
   4.2 changed the pointer name from pMONSTER to MONSTER. shorter, more elegant and easier for the coder to use (to inherit)

5. Conclusion: We should treat all the objects appearing here as pointers, and use "->" to access their member functions
*/


//// Declare a Trader object, and assign its members
Trader* trader;             // we define a pointer "trader" pointing to the object(class) "Trader"
 
trader->level    = 15;                                                                                //這邊的數據可以改你想要的
trader->longDesc = "xx是專門進口國外物資的商人, 現在正在港口不斷的踱步, 或許你可以問問他發生什麼事情了(matter)";           
trader->name     = "xx商人";																			 
trader->unit     = "位";
trader->gender   = false;    // it's a guy

/* actually I believe there's a trigger design in RT
   就是不用特地又在 main 裡寫一次, 只要 class 裡寫好的話, 只要符合條件, 就會自動執行 (像 trigger) 一樣
   這在 programming 叫做 event_driven, 一般而言, 這樣的function 命名都是以 event_ 開頭
   不過我們在這兒就還是 trigger__ 開頭沒關係
*/

// 所以下面的 code 應該移動 trader.cpp 去, 讓 main.c 愈短愈好 
if (player->input__ask_accept)  //if player accept the quest  // (or quest_accept, whichever is clearer)
{
    Qstep=1;
    write("@MATT
你能幫我解決這個問題, 真是太好了. 可是要到達那裡混進去那群乞丐不是簡           //如果輸入accept 之後 告訴玩家下一步怎麼做的敘述
單的事情,你可以去裁縫A那裡請他幫你準備乞丐袍, 到木工B那邊找到小船,
MATT");
    quest_accepted = true;
}

/*
下面這個也是如法炮製, 移到 trader.cpp 去 (也是一個 trigger)	
(trader.cpp 裡應該有個對應的 member function 處理這個step, 就像其它我寫的一樣...這就留給你改了)
should be something like this:

if trader->receive("車杉木")
{
    // do "沒錯....就是這個木..........."
}

*/
if (player gives trader 車杉木 back) //if player give 車杉木 back to trader
{
    write("@MATT
沒錯, 就是這車杉木, 真是太感激了可以幫我找回這些貢品, 這是給你的酬勞 //完成任務後的回覆
           , 我也會跟皇室報告你英勇的行為的.
MATT");
    this_quest = finished;

}
